--止战之殇
local zhizhanzhishang = fk.CreateSkill {
    name = "mcdh_zhizhanzhishang",
}

local U = require "packages/utility/utility"
local lib = require "packages/mcdh/lib"

zhizhanzhishang:addEffect(fk.TargetSpecified,{
    can_trigger = function(self, event, target, player, data)
        return player:hasSkill(self) and target==player and player:getMark("mcdh_ammo") >=2 and data.card and data.card.trueName =="slash"
    end,
    on_cost = function(self,event,target,player,data)
        return player.room:askForSkillInvoke(player, self.name, nil, "#zhizhanzhishang-invoke:"..data.to.id)
    end,
    on_use = function(self, event, target, player, data)
        local room = player.room
        lib.mcdh_ammo(player,-2,0)
        local tar = data.to
        local handcards = tar:getCardIds("h")
        tar:showCards(handcards)
        local re = {}
        local cards  = tar:getCardIds("he")
        for _, id in ipairs(cards) do
            if Fk:getCardById(id).is_damage_card or Fk:getCardById(id).sub_type == Card.SubtypeWeapon  then
                table.insert(re,id)
            end
        end
        room:recastCard(re, tar, self.name)
        data.fixedResponseTimes = data.fixedResponseTimes or {}
        data.fixedResponseTimes["jink"] =   1+(#re or 0 )
        if #re >=2 then
            data.additionalDamage = (data.additionalDamage or 0) + 1
        end
    end,
})

Fk:loadTranslationTable{
    ["mcdh_zhizhanzhishang"] ="止战之殇",
    [":mcdh_zhizhanzhishang"]="装填技(2)，当你使用【杀】指定一名角色为目标后，你可以令其展示手牌并令其重铸其区域内的伤害牌和武器牌，此【杀】需要多使用X张【闪】抵消，若其X不小于2，此【杀】伤害+1。（X为其本次重铸牌数）",
    ["#zhizhanzhishang-invoke"] = "令 %src 展示手牌并令其重铸其区域内的伤害牌和武器牌",
}

return zhizhanzhishang